Skip to content

fix(cinder): emit volume inventory once per volume - #159

Open
Jeremy Lee (legit-ninja) wants to merge 1 commit into
vexxhost:mainfrom
samaritanark:contrib/cinder-inventory-2b1
Open

Jeremy Lee (legit-ninja) wants to merge 1 commit into
vexxhost:mainfrom
samaritanark:contrib/cinder-inventory-2b1

Conversation

@legit-ninja

@legit-ninja Jeremy Lee (legit-ninja) commented Dec 1, 2026 •

Copy link
Copy Markdown

Summary

VolumeGetAllWithAttachments returns one row per volume attachment, so the Cinder volumes collector emitted duplicate openstack_cinder_volume_gb and openstack_cinder_volume_status samples for multi-attached volumes and over-counted openstack_cinder_volumes and the per-status counts. When duplicate rows carry the same labels, the Prometheus registry can also fail the scrape.

This groups attachment rows by volume ID so each volume is emitted once.

Changes

  • One volume_gb and one volume_status sample per volume. Capacity stays in GiB and the size label keeps its raw GiB value.
  • server_id is empty when no server is attached, the server UUID for a single attachment, or a comma-separated, lexically sorted list of distinct server UUIDs for multi-attachment. Empty server IDs are dropped.
  • openstack_cinder_volumes and the status counters count distinct volume IDs.
  • Metric names and label keys are unchanged.

Compatibility

For multi-attached volumes, server_id now holds a list, so a query matching one server UUID exactly will not match those volumes. Single-attachment and unattached volumes produce the same series as before.

The attachment query excludes soft-deleted attachments but has no attachment status or timestamps, so nondeleted historical attachments still contribute their server IDs.

Tests

  • Unit tests for duplicate and reordered attachment rows, using pedantic registry gathering.
  • Repeated HTTP exposition alongside Heat metrics to confirm the scrape no longer fails on duplicates.

No openstackdb changes are needed. Independent of the other exporter PRs; #162 later renames volume_gb to volume_bytes and will need its README reconciled with this one.

Group attachment rows by volume ID for inventory and status counts. Retain distinct nonempty server IDs in sorted order while preserving GiB capacity and existing labels.

Cover duplicate and reordered attachments with pedantic gathering and repeated HTTP exposition alongside Heat metrics.

Signed-off-by: David Hulick <dave.hulick@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants